package com.tangruojie;

import com.tangruojie.dao.OrderDao;
import com.tangruojie.factory.OrderDaoFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppForInstanceOrder {

    public static void main(String[] args) {

        /**
         * 通过静态工厂创建对象
         */
//        OrderDao orderDao = OrderDaoFactory.getOrderDao();
//        orderDao.save();

        /**
         * 使用静态工厂实例化bean
         */
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        OrderDao orderDao = (OrderDao) ctx.getBean("orderDao");
        orderDao.save();

    }

}
